<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/axios.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="css/bootstrap.min%20(1).css"/>
	</head>
	<body>
		<div id="app">
			<table class="table table-bordered">
				<tr>
					<th>文章Id</th>
					<th>文章标题</th>
					<th>文章内容</th>
					<th>文章作者</th>
					<th>操作</th>
				</tr>
				<tr v-for="v in article">
					<td>{{v.id}}</td>
					<td>{{v.tittle}}</td>
					<td>{{v.content}}</td>
					<td>{{v.author}}</td>
					<td><button type="button">删除</button></td>
				</tr>
			</table>
			<button type="button" @click="getpage(page-1)">上一页</button>
			<button type="button" v-for="v in sumpage" @click="getpage(v)">{{v}}</button>
			<button type="button" @click="getpage(page+1)">下一页</button>
		</div>
	</body>
</html>
<script type="text/javascript">
	var app=new Vue({
		el:"#app",
		data:{
			article:[],
			page:"",
			size:"",
			count:"",
			sumpage:"",
			id:"",
			title:"",
			content:"",
			author:"",
		},
		methods:{
			getpage(page){
				axios.post("http://127.0.0.1:8080/page?page="+page).then(res=>{
					console.log(res)
					app.article=res.data.data
					app.size=res.data.size
					app.page=res.data.page
					app.count=res.data.count
					app.sumpage=res.data.sumpage
				})
			}
		},
		created:function(){
			axios.post("http://127.0.0.1:8080/page").then(res=>{
				console.log(res)
				app.article=res.data.data
				app.size=res.data.size
				app.page=res.data.page
				app.count=res.data.count
				app.sumpage=res.data.sumpage
				
			})
		}
	})
</script>
